home *** CD-ROM | disk | FTP | other *** search
/ Amiga Collections: Purity / Purity #42 (1995-01)(PackMAN)(DE)[WB].zip / Purity #42 (1995-01)(PackMAN)(DE)[WB].adf / Includes3v1 / Includes3v1.lha / Utils / CRT.i < prev    next >
Text File  |  1994-12-04  |  4KB  |  178 lines

  1. {
  2.         CRT.i for PCQ Pascal
  3.  
  4.         These routines are a simple attempt to mimic the some of the
  5.     Turbo Pascal CRT routines.  See ConsoleTest.p for an example of 
  6.     using these.
  7.         Note that ConsoleSetPtr, the actual type returned by
  8.     AttachConsole, is not defined here.  I wanted to implement it as sort
  9.     of an opaque type.
  10.         The source for these routines is under Runtime/Extras, in
  11.     CRT.p and CRT2.p.
  12. }
  13.  
  14. {$I   "Include:Intuition/Intuition.i"}
  15.  
  16.  
  17.  
  18. {
  19.     Initialize the CRT routines for a particular window.  This routine
  20.     returns Nil if there is a problem, or a pointer to a record that
  21.     stores the important information the rest of the routines require.
  22.  
  23.     AttachConsole must be called before any of the other routines.
  24. }
  25.  
  26. Function AttachConsole(w : WindowPtr) : Address;
  27.     External;
  28.  
  29.  
  30. {
  31.     Clear from the cursor position to the end of the line
  32. }
  33.  
  34. Procedure ClrEOL(CRT : Address);
  35.     External;
  36.  
  37.  
  38. {
  39.     Clear the text area of the window, and moves the cursor to 1,1
  40. }
  41.  
  42. Procedure ClrScr(CRT : Address);
  43.     External;
  44.  
  45.  
  46. {
  47.     Turn the console device's text cursor off.  Note that this is not
  48.     the same as the mouse pointer.
  49. }
  50.  
  51. Procedure CursOff(CRT : Address);
  52.     External;
  53.  
  54.  
  55. {
  56.     Turn the text cursor on
  57. }
  58.  
  59. Procedure CursOn(CRT : Address);
  60.     External;
  61.  
  62.  
  63. {
  64.     Delete the line the cursor is on, moving all lines below it
  65.     up one and clearing the bottom line.
  66. }
  67.  
  68. Procedure DelLine(CRT : Address);
  69.     External;
  70.  
  71. {
  72.     Close the console device and free any memory allocated by the
  73.     AttachConsole call.  Also, take care of any pending console IO.
  74.     This routine must be called before the program terminates, and
  75.     before the window is closed.
  76. }
  77.  
  78. Procedure DetachConsole(CRT : Address);
  79.     External;
  80.  
  81.  
  82. {
  83.     Move the text cursor to the specified column and row X,Y.
  84. }
  85.  
  86. Procedure GotoXY(CRT : Address; x,y : Short);
  87.     External;
  88.  
  89.  
  90.  
  91. {
  92.     Insert a line at the current cursor position.  The current line
  93.     and all those below it are moved down one.
  94. }
  95.  
  96. Procedure InsLine(CRT : Address);
  97.     External;
  98.  
  99.  
  100.  
  101. {
  102.     Returns TRUE if there is a key waiting at the console
  103. }
  104.  
  105. Function KeyPressed(CRT : Address) : Boolean;
  106.     External;
  107.  
  108.  
  109. {
  110.     Return the maximum character column for the window
  111. }
  112.  
  113. Function MaxX(CRT : Address) : Short;
  114.     External;
  115.  
  116. {
  117.     Return the maximum character row for the window
  118. }
  119.  
  120. Function MaxY(CRT : Address) : Short;
  121.     External;
  122.  
  123.  
  124.  
  125. {
  126.     Wait for a key to be pressed, and return it.  CRT is a pointer to
  127.     the CRT record returned by AttachConsole.  Note that the key will
  128.     not automatically be displayed - you'll have to call WriteString
  129.     or something.
  130. }
  131.  
  132. Function ReadKey(CRT : Address) : Char;
  133.     External;
  134.  
  135.  
  136. {
  137.     Set the foreground (text) pen number.  The actual color displayed
  138.     depends on the color map in use for the screen, so you'll have
  139.     to use SetRGB4 calls (or the equivalent) to get particular values.
  140. }
  141.  
  142. Procedure TextColor(CRT : Address; t : Byte);
  143.     External;
  144.  
  145.  
  146.  
  147. {
  148.     Set the background color for the text.
  149. }
  150.  
  151. Procedure TextBackground(CRT : Address; t : Byte);
  152.     External;
  153.  
  154. {
  155.     Return the current text cursor column
  156. }
  157.  
  158. Function WhereX(CRT : Address) : Short;
  159.     External;
  160.  
  161. {
  162.     Return the current text cursor row
  163. }
  164.  
  165. Function WhereY(CRT : Address) : Short;
  166.     External;
  167.  
  168.  
  169.  
  170. {
  171.     Write a string to the window through the console device.  The
  172.     string can contain ANSI codes to change the pen colors, move
  173.     the cursor, just about anything.
  174. }
  175.  
  176. Procedure WriteString(CRT : Address; Str : String);
  177.     External;
  178.